<template>
  <div class="detail" v-if="Object.keys(result).length > 0">
    <div class="title">
      <title-view :result="result"></title-view>
    </div>
    <div class="good">
      <div class="img">
        <img-view :result="result"></img-view>
      </div>
      <div class="info">
        <infoView :result="result"></infoView>
      </div>
    </div>
  </div>
</template>

<script>
import { GetDetails } from '@/api'
import titleView from './title.vue'
import imgView from './img.vue'
import infoView from './info.vue'
export default {
  async created() {
    try {
      // console.log(this.$route.query.id)
      const result = await GetDetails(this.$route.query.id)
      this.result = result.result
      // console.log(this.result)
    } catch (error) {
      console.log(error.message)
    }
  },
  data() {
    return {
      result: {}
    }
  },
  components: {
    titleView,
    imgView,
    infoView
  }
}
</script>

<style scoped>
.detail {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 10px;
  background-color: white;
  /* border: 1px solid #000; */
}
.title {
  width: 100%;
  background-color: rgb(240, 240, 240);
  /* background-color: rgb(209, 31, 31); */
}
.good {
  width: 1200px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
}
</style>
